// 手写bind
Function.prototype.myBind = function(context) {
    //判断调用对象是否是函数
    if (typeof this !== "function") {
        throw new TypeError('Error');
    }

    // 获取参数
    const args = [...arguments].slice(1), fn = this;

    return function Fn() {
        return fn.apply(this instanceof Fn ? new fn(...arguments) : context, args.concat(...arguments));
    }

}
